<?php
// 本类由系统自动生成，仅供测试用途
class UserAction extends Action {
    public function index(){
        //$Form = M("User");
        // 按照id排序显示前6条记录
        //$list = $Form->order('id desc')->limit(60)->select();
        //$this->assign('list', $list);
        //$this->display();

    $User = M('User'); // 实例化User对象
    // 进行分页数据查询 注意page方法的参数的前面部分是当前的页数使用 $_GET[p]获取
	//$_GET['p'] = isset($_GET['p']) ? $_GET['p'] : 1;
    //$list = $User->where('status=1')->order('id desc')->page($_GET['p'].',15')->select();
    //$this->assign('list',$list);// 赋值数据集
    //import("ORG.Util.Page");// 导入分页类
    //$count      = $User->where('status=1')->count();// 查询满足要求的总记录数
    //$Page       = new Page($count,25);// 实例化分页类 传入总记录数和每页显示的记录数
    //$show       = $Page->show();// 分页显示输出

import("ORG.Util.Page");// 导入分页类

//$condition['verify'] = $_POST['verify'];
//$condition['account'] = array('like',"%".$_POST['account']."%");

if(isset($_REQUEST['verify']) && !empty($_REQUEST['verify'])) $condition['verify'] = $_REQUEST['verify'];
if(isset($_REQUEST['account']) && !empty($_REQUEST['account'])) $condition['account'] = array('like',"%".$_REQUEST['account']."%");

 //if(!isset($condition)) $condition='1=1';
 
 //dump($condition);
$mapcount      = $User->where($condition)->count();// 查询满足要求的总记录数

$Page       = new Page($mapcount,8);// 实例化分页类 传入总记录数和每页显示的记录数

//分页跳转的时候保证查询条件
$map['verify'] = $_REQUEST['verify'];
//$map['account'] = $_REQUEST['account'];
$map['account'] =$_REQUEST['account'];
 foreach($map as $key=>$val) {
      $Page->parameter   .=   "$key=".urlencode($val)."&";
  }

$show       = $Page->show();// 分页显示输出

  $list = $User->where($condition)->order('id desc')->limit($Page->firstRow.','.$Page->listRows)->select();

	
	//echo $User->getLastSql();
	//print_r($condition);
	
	$this->assign('list',$list);// 赋值数据集
	$this->assign('condition',$map);// 赋值数据集
    $this->assign('page',$show);// 赋值分页输出
    $this->display(); // 输出模板			
		
    }
	
	
	
   public function login()
   {
	    $this->display('Public/login.hmtl');
   }	
	
	
	
}